# /usr/bin/python3
# coding=utf-8
# @Time:2025/7/27 17:20
# @Author: cc
import yaml
from common.tools import get_project_path, sep


# file = open ("/Users/sunmengran/Desktop/Automated_Testing/PythonProject2/check_price/config/enviroment.yaml", "r",
#              encoding="utf-8")
# try :
#     a = file.read ( )
#     print (a)
# except Exception as e :
#     print (e)
# finally :
#     file.close ( )

class GetConfig :
    def __init__(self) :
        with open (get_project_path ( ) + sep (['config', 'enviroment.yaml'], add_sep_before=True), 'r',
                   encoding="utf-8") as env_file :
            self.env = yaml.load (env_file, Loader=yaml.FullLoader)

    def get_username_password(self) :
        return self.env['username'], self.env['password']

    def get_mysql_data(self) :
        return self.env['mysql']['db'], self.env['mysql']['host'], self.env['mysql']['password'], self.env['mysql'][
            'port'], self.env['mysql']['user']
    def get_url(self) :
        return self.env['url']


if __name__ == '__main__' :
    print (GetConfig ( ).get_url ( ))
    # print (GetConfig ( ).get_mysql_data ( ))
